package com.shu.component_base.utils.convenient;

import android.util.Log;
/**
 * Dialog工具类
 * author yangshu
 * CreateDate 20.7.23
 */
public class LogUtils {
    private static int currentLev = 4;
    private static final int DEBUG_LEV = 4;
    private static final int INFO_LEV = 3;
    private static final int WARM_LEV = 2;
    private static final int ERROR_LEV = 1;

    public static void setCurrentLev(int currentLev)
    {
        LogUtils.currentLev = currentLev;
    }

    /**
     * 通过对象
     * @param object
     * @param log
     */
    public static void d(Object object, String log)
    {
        if (currentLev >= DEBUG_LEV) {
            Log.d(object.getClass().getSimpleName(), log);
        }
    }

    /**
     * 通过对象加标记位置加log
     * @param object
     * @param position
     * @param log
     */
    public static void d(Object object,String position, String log)
    {
        if (currentLev >= DEBUG_LEV) {
            Log.d(object.getClass().getSimpleName(), position+"======>"+log);
        }
    }

    /**
     * 通过string 和log
     * @param tag
     * @param log
     */
    public static void d(String tag, String log)
    {
        if (currentLev >= DEBUG_LEV) {
            Log.d(tag, log);
        }
    }

    public static void i(Object object, String log)
    {
        if (currentLev >= INFO_LEV) {
            Log.i(object.getClass().getSimpleName(), log);
        }
    }
    public static void i(Object object,String position, String log)
    {
        if (currentLev >= INFO_LEV) {
            Log.d(object.getClass().getSimpleName(), position+"======>"+log);
        }
    }
    public static void i(String tag, String log)
    {
        if (currentLev >= INFO_LEV) {
            Log.i(tag, log);
        }
    }

    public static void w(Object object, String log)
    {
        if (currentLev >= WARM_LEV) {
            Log.w(object.getClass().getSimpleName(), log);
        }
    }
    public static void w(Object object,String position, String log)
    {
        if (currentLev >= WARM_LEV) {
            Log.d(object.getClass().getSimpleName(), position+"======>"+log);
        }
    }
    public static void w(String tag, String log)
    {
        if (currentLev >= WARM_LEV) {
            Log.w(tag, log);
        }
    }

    public static void e(Object object, String log)
    {
        if (currentLev >= ERROR_LEV) {
            Log.e(object.getClass().getSimpleName(), log);
        }
    }
    public static void e(Object object,String position, String log)
    {
        if (currentLev >= ERROR_LEV) {
            Log.d(object.getClass().getSimpleName(), position+"======>"+log);
        }
    }
    public static void e(String tag, String log)
    {
        if (currentLev >= ERROR_LEV) {
            Log.e(tag, log);
        }
    }
}
